<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <h2>大小写转换</h2>
    原数据：<input id='old' type="text">
    <input id='button' type="button" value="转大写" onclick="deal('upper')">
    <input id='button' type="button" value="转小写" onclick="deal('lower')">
    <br>
    新数据：<input id='new' type="text">
    <script>
    function deal(str){
        var oldData=document.getElementById("old").value;
        switch(str){
            case 'upper':
            oldData=oldData.toUpperCase();
            break;
            case 'lower':
            oldData=oldData.toLowerCase();
            break;
        }
        document.getElementById('new').value=oldData;
    }
    </script>
    <a href="..\第四章.html">返回第四章</a>

</body>
</html>